<template>
    <div id="app" class="scroll">
        <!--<router-view class="view"></router-view>-->
        <keep-alive >
            <router-view v-if="$route.meta.keepAlive && show"></router-view>
        </keep-alive>
        <router-view v-if="!$route.meta.keepAlive && show"></router-view>
        <div class="clearB"></div>
    </div>
</template>

<script>
    import {appService} from './service/appService'
    import Vue from 'vue'
    import Element from 'element-ui'
    import 'element-ui/lib/theme-chalk/index.css'
    // import './mixin/directive';
    import './mixin/filter';
    
    Vue.use(Element)

    export default {
        name: 'app',
        
        components: {},
        data(){
            return{
                show:false,
            }
        },
        mounted: function () {
            this.$nextTick(function(){
                this.show = true
            });
            /*if(appService.getUserInfo()) {
             let now = new Date()
             //                console.log(this.$store.state.userInfo.exp*1000);
             //                console.log(now.getTime());
             let t = this.$store.state.userInfo.exp*1000 - now.getTime() ;   //时间差的毫秒数
             let h = Math.floor(t/(3600*1000))
             if(h<3){
             appService.putToken()
             }
             }*/
             if(this.$route.name=='articles'){
              
            }else if(this.$route.name=='binding'){

            }else if(this.$route.name=='backpassword'){

            }else if(this.$route.name=='register'){

            }else if(this.$route.name=='bindingexisting'){

            }else if(this.$route.name=='wxlogin'){

            }else{
              if(!appService.checkLogin()){
                  this.$router.push({path:'/login'}) 
            }else{
                if(this.$route.name=='app'){
                 this.$router.push({path:'/home'}) 
                }
            }
            }

            appService.onBridgeReady();
            // this.getFootPrint()
        },
        methods: {
            // getFootPrint(){
            //     let that = this;
            //     let cookiesId  = window.localStorage.getItem('cookiesId');
             
            //     if(cookiesId  == undefined || cookiesId  == '' || cookiesId  == null){
            //         cookiesId  = Date.parse(new Date());
            //         cookiesId  = "zstat" + "-" + cookiesId  + "-" + Math.round(Math.random() * 3000000000);
            //         let arr=[1]
            //         window.localStorage.setItem('cookiesId',cookiesId );
            //         window.localStorage.setItem('articles',JSON.stringify(arr));
            //         cookiesId=''
            //     }
            //     // commonService.getFootPrint({pageNo:1,pageSize:50,cookiesId:cookiesId }).then(function(res){
            //     //     if(res.data.code === 200){
            //     //         that.footPrint=res.data.datas.datas
            //     //     }
            //     // })
            // },
        }
    }
</script>

<style lang="less">
    /*@import url('assets/css/base.less');*/
    @import url('assets/css/icon/iconfont.css');
    @import "./assets/css/theme.less";
    @import './assets/css/common/swiper.min.css';
    @import './assets/css/base.less';
    html, body {
        margin: 0 auto;
        width: 100%;
        word-wrap: break-word;
        /*overflow: scroll;*/
        height: 100%;
        /*max-width: 450px;*/
        position:relative;
    }
    body {
        font-family: PingFang SC,Hiragino Sans GB,Microsoft YaHei,WenQuanYi Micro Hei,Helvetica Neue,Arial,sans-serif;
    }
    p{margin: 0;}
    #home {
        padding-bottom: 65px;
    }
    .omit {
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box !important;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

</style>